#!/usr/bin/env python
# -*- coding:utf-8 -*-
# 天气查询
def cscx(city):
    url = 'https://restapi.amap.com/v3/weather/weatherInfo?city=%s&key=d7c4f8b2b484585de0c319f9b8ca4652&extensions=all'%city
    import requests
    poo  = requests.get(url)
    data = poo.json()
    data = data['forecasts'][0]['casts']
    # print(data)
    rq = {'1':'一','2':'二','3':'三','4':'四','5':'五','6':'六','7':'日'}
    now_data = []
    for i in data:
        # print(i)/
        lis = {}
        lis['date'] = i['date']
        lis['week'] = rq.get(i['week'])
        if i['dayweather'] ==  i['nightweather']:
            lis['weather'] = i['dayweather']
        else:
            lis['weather'] = i['dayweather']  + '转'+ i['nightweather']
        lis['temp'] = i['daytemp']  + ' ~ '+ i['nighttemp']+'℃'
        if i['daywind'] ==  i['nightwind']:
            lis['wind'] = i['daywind']
        else:
            lis['wind'] = i['daywind']  + '风转'+ i['nightwind'] + '风'

        lis['power'] = i['daypower'] + '级'
        now_data.append(lis)
    return  now_data

